<?php
declare (strict_types = 1);

namespace app\admin\controller;

use think\facade\Db;
use think\facade\Request;
use think\facade\View;

class Good
{
    public function goodAdd()
    {
        return view();
    }
    public function goodList()
    {
        $where=[];
        $post=Request::param('','');
        if(isset($post['is_down']) && count($post['is_down'])==1){$where[]=['is_down','in',$post['is_down']];}
        if(isset($post['is_show']) && $post['is_show']<>''){$where[]=['is_show','=',$post['is_show']];}
        if(isset($post['is_hot']) && $post['is_hot']<>''){$where[]=['is_hot','=',$post['is_hot']];}
        if(isset($post['keys']) && $post['keys']<>''){$where[]=['g.name','like',"%{$post['keys']}%"];}
        if(isset($post['cid']) && $post['cid']<>''){$where[]=['cid','=',$post['cid']];}

        $list= \app\admin\model\Goods::getGoodList($where,$post);
        View::assign('list',$list);
        View::assign($post);


        $cateF=\app\admin\model\Category::getCateF();
        $cateS=\app\admin\model\Category::getCateS();
        View::assign('cateF',$cateF);
        View::assign('cateS',$cateS);
        View::assign($post);
        return view();
    }
    public function goodEdit()
    {
        return view();
    }

}
